<?php
if(!empty($_GET['file'])) {
    $path = dirname(__FILE__).DIRECTORY_SEPARATOR.'library';
    $file = preg_replace('/[^\d\.pdf]/', '', $_GET['file']);
    header("Content-type: application/pdf");
    header("Content-Disposition: attachment; filename=$file");
    header("Pragma: no-cache");
    header("Expires: 0");
    print file_get_contents($path.DIRECTORY_SEPARATOR.$file);
} else {
    die();
}
?>
